{% extends 'home_base.html' %}
{% block head %}
<title>新闻详情页</title>
{% endblock %}
{% block content %}
    <!-- flash消息 -->
  {% for message in get_flashed_messages() %}
    <div class="alert alert-warning">
    <button type="button" class="close" data-dismiss="alert">&times;</button>
    {{ message }}
    </div>
  {% endfor %}
  <!-- //flash消息 -->
<h3>{{ new_obj.title }}</h3>
<p>{{ new_obj.content }}</p>
    <hr>
    <h4>评论列表</h4>
    {% for comment_obj in new_obj.get_comments()  %}
        <blockquote>
            {{ comment_obj.content }}
            <footer class="text-muted text-right">{{ comment_obj.created_at }}</footer>
        </blockquote>
    {% endfor %}

    <h4>发表评论</h4>
<form class="form-horizontal" role="form" method='post' action="{{ url_for('comment_add',news_id=new_obj.id) }}">
  <div class="form-group">
    <div class="col-sm-10">
       {{ form.content }}
        {% if form.content.errors %}
            <span class="text-danger">
                {{ form.content.errors }}
            </span>
        {% endif %}
    </div>
  </div>
  <div class="form-group">
    <div class="col-sm-offset-2 col-sm-10">
        {{ form.csrf_token }}
        {{ form.object_id }}
        {{ form.reply_id }}
        {{ form.submit }}
    </div>
  </div>
</form>
{% endblock %}